<template>
    <div class="echart-chart">
        <div class="inside">
            <header><i class="el-icon-location-outline"></i> 负资产率（本都会区）</header>
            <div class="chartBox clearfix" style="min-height: 100px;">
                <aside v-show="!chartNoDataShow">
                    <p>低价位房产负资产率：{{ isNull0(bottom_tier_ne_pct) }}</p>
                    <p>中价位房产负资产率：{{ isNull0(middle_tier_ne_pct) }}</p>
                    <p>高价位房产负资产率：{{ isNull0(top_tier_ne_pct) }}</p>
                </aside>
                <article v-show="!chartNoDataShow">
                    <p>目前的房价低于之前购买的市值比例</p>
                </article>
                <h4 ref="Metro_NETiers_2017Q4_NoData" v-show="chartNoDataShow"></h4>
            </div>
            <p v-show="false">{{getzipcode}}</p>

        </div>
    </div>
</template>

<script>
    export default {
        data() {
            return {
                chartNoDataShow: false, //判断是否有无数据
                bottom_tier_ne_pct: '', //低价房产负资产率
                middle_tier_ne_pct: '', //中价房产负资产率
                top_tier_ne_pct: '', //高价房产负资产率

            }
        },
        computed: {
            //房源详情页图表使用——本房源所在邮zipcode
            getzipcode() {
                if(this.$store.getters.get_houseDetailsZipcode){
                    //获取负资产率（本都会区）数据
                    this.get_Metro_NETiers_2017Q4();
                }
                return this.$store.getters.get_houseDetailsZipcode
            },

        },
        created() {
        },
        mounted() {
        },
        methods: {
            //获取负资产率（本都会区）数据
            get_Metro_NETiers_2017Q4() {
                this.$get('/analysis/negative_equity_metro/100/'+ this.$store.getters.get_houseDetailsZipcode).then(res => {
                    if (res.status == 0) {
                        if(res.data != null){
                            this.chartNoDataShow = false;
                            this.bottom_tier_ne_pct = res.data.bottom_tier_ne_pct ? (res.data.bottom_tier_ne_pct * 100).toFixed(2) +'%' : 0;
                            this.middle_tier_ne_pct = res.data.middle_tier_ne_pct ? (res.data.middle_tier_ne_pct * 100).toFixed(2) +'%' : 0;
                            this.top_tier_ne_pct = res.data.top_tier_ne_pct ? (res.data.top_tier_ne_pct * 100).toFixed(2) +'%' : 0;
                        }else{
                            this.chartNoDataShow = true;
                            this.$refs.Metro_NETiers_2017Q4_NoData.innerText = '暂未查询到数据！';
                        }
                    } else {
                        this.chartNoDataShow = true;
                        this.$refs.Metro_NETiers_2017Q4_NoData.innerText = '暂未查询到数据！';
                    }
                });
            },
        },
        components: {}
    }
</script>

<style scoped lang="less" type="text/less">
</style>
